<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
    <%@ page import="java.sql.*"%>
    <%@ page import="java.io.*"%> 
    <%@ page import="java.util.*"%> 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body>
<%
	request.setCharacterEncoding("GBK");
	String name=request.getParameter("userName");
	String pwd=request.getParameter("password");
 	Connection con=null;
 	Statement stmt=null;
 	ResultSet rs=null;
 	try{
 		Class.forName("com.mysql.jdbc.Driver");
 		con=DriverManager.getConnection("jdbc:mysql://localhost:3306/test?"
 		+"user=root&password=123456&useUnicode=true&characterEncoding=GB2312" );
 		stmt=con.createStatement();
 		rs=stmt.executeQuery("select * from  admin where uname='"+name+"'" );
 		if(rs.next()){
 			request.setAttribute("message","登录成功。");
 			response.sendRedirect("Login.jsp");
 		}else{
 			out.println("登录失败");
 		}
 	}catch(Exception ex){
 		out.print("连接失败！！<br>"+ex.toString()); 
 	}
	
%>
</body>
</html>